package org.wangnian.validationdemo.validator.annotation;

import org.wangnian.validationdemo.validator.InEnumValidator;
import org.wangnian.validationdemo.validator.enums.BasicEnum;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;


@Target({ElementType.METHOD,ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = InEnumValidator.class)
public @interface InEnum {

    /**
     * 枚举类型
     * @return
     */
    Class<? extends BasicEnum> enumType() default BasicEnum.class;

    String message() default "枚举类型不匹配";

    Class<?>[] groups() default { };

    Class<? extends Payload>[] payload() default { };

}
